package com.yohann.designPattern.chain;

/**
 * <p>
 * 客户端
 * </p>
 *
 * @author Yohann
 * @since 2021/2/13 18:40
 */
public class Client {
    public static void main(String[] args) {
        PurchaseRequest request1 = new PurchaseRequest(1, 3000, 1);
        PurchaseRequest request2 = new PurchaseRequest(1, 50001, 1);

        DepartmentApprove departmentApprove = new DepartmentApprove("DepartmentApprove");
        CollegeApprove collegeApprove = new CollegeApprove("CollegeApprove");
        departmentApprove.setApprove(collegeApprove);

        /*
         * 请求被DepartmentApprove处理
         * 请求被CollegeApprove处理
         * 请求被CollegeApprove处理
         * 请求被CollegeApprove处理
         */
        departmentApprove.processRequest(request1);
        departmentApprove.processRequest(request2);
        collegeApprove.processRequest(request1);
        collegeApprove.processRequest(request2);
    }
}